const mysql = require('mysql');

const userConnect = mysql.createConnection({
    host: 'localhost',
    port: 3306,
    user: 'root',
    password: '123456',
    database: '1903a'
});

const query = (sql)=>{
    return new Promise((resolve, reject) => {
        userConnect.query(sql, (err, data) => {
            if(err){
                reject(err);
            } else {
                resolve(data);
            }
        });
    })
}

module.exports = query;